﻿using MediatR;
using S.Eartag.Domain;
using S.Eartag.Infrastructure.Interface;
using S.Eartag.Read.API.Application.Command.SheepFileConditionCommand;

namespace S.Eartag.Read.API.Application.CommandHandlers.SheepFileConditionCommandHandler
{
    public class SheepFileConditionSexCommandHandler : IRequestHandler<SheepFileConditionSexCommand, List<object>>
    {
        private readonly ISheepFileRepository sheepFileRepository;

        public SheepFileConditionSexCommandHandler(ISheepFileRepository sheepFileRepository)
        {
            this.sheepFileRepository = sheepFileRepository;
        }

        public async Task<List<object>> Handle(SheepFileConditionSexCommand request, CancellationToken cancellationToken)
        {
            List<object> res = new List<object>();
            foreach (var item in Enum.GetValues<sex>())
            {
                res.Add(new
                {
                    name = item.ToString(),
                    value = item
                });
            }
            return  res;
        }
    }
}
